/*
 * @Author: hmhvictory 1400628624@qq.com
 * @Date: 2025-07-22 16:42:56
 * @LastEditors: hmhvictory 1400628624@qq.com
 * @LastEditTime: 2025-07-22 16:55:22
 * @FilePath: \实训笔记\day07\demo1.java
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
package day07;

import java.util.Scanner;

public class LeapYearChecker {
    // 判断是否为闰年的方法
    public static boolean isLeapYear(int year) {       
        return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
    }   
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入年份：");
        int year = scanner.nextInt();       
        if (isLeapYear(year)) {
            System.out.println(year + "年是闰年");
        } else {
            System.out.println(year + "年不是闰年");
        }       
        scanner.close();
    }
}
